﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinformPratice
{
    public partial class Decode : Form
    {
        public Decode()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string[] array = textBox1.Text.Split(new char[]
			{
				';'
			});
            for (int j = 0; j < array.Length - 1; j++)
            {
                stringBuilder.Append((char)(int.Parse(array[j]) ^ j << 2));
            }
            textBox2.Text = stringBuilder.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();
            char[] array = textBox1.Text.ToCharArray();
            for (int j = 0; j < array.Length; j++)
            {
                stringBuilder.Append((int)array[j] ^ j << 2);
                stringBuilder.Append(";");
            }
            textBox2.Text = stringBuilder.ToString();
        }
    }
}
